package com.sky.controller.admin;

import com.sky.result.Result;
import com.sky.service.ShopService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Auther: zhaoss
 * @Date: 2023/5/3 - 05 - 03 - 20:15
 * @Description: com.sky.controller.admin
 * @version: 1.0
 */
@RestController("adminShopController")
@RequestMapping("/admin/shop")
@Api(tags = "店铺相关接口")
@Slf4j
public class ShopController {
    @Autowired
    private ShopService shopService;
    /**
     * 修改状态
     * @param status
     * @return
     */
    @PutMapping("/{status}")
    public Result putShop(@PathVariable Integer status){
        log.info("设置店铺的营业状态为：{}",status == 1 ? "营业中" : "打烊中");
        return shopService.putShop(status);
    }

    /**
     * 查询店铺状态
     * @return
     */
    @GetMapping("/status")
    public Result getStatus(){

        return shopService.getStatus();
    }
}
